|
|
|
|
|
|
|
Figure 6.4
Program ColorBal adjusts an image's color balance. |
|
|
|
 |
|
|
|
|
If b_factor < 0 Then
.rgbBlue = (1 + b_factor) * .rgbBlue
Else
.rgbBlue = .rgbBlue + b_factor * (255 .rgbBlue)
End If
End With |
|
|
|
|
|
|
|
|
If you set all three scroll bars to the same value, the program acts just as program Bright does, adjusting the image's brightness. |
|
|
|
|
|
|
|
|
Like brightness adjustments, color balance adjustments are not invertible. If you change an image's color balance, you cannot load the result and adjust its colors to restore the original image exactly. |
|
|
|
|
|
|
|
|
Contrast measures the difference between two colors. There is a lot of contrast between black and white because they are very different. There is less contrast between red and pink because they are fairly similar. |
|
|
|
|
|
|
|
|
An image's contrast is a measurement of the distribution of the colors it contains. One way to graphically examine an image's contrast is to plot a histogram showing the number of pixels that have each color value. |
|
|
|
|
|
|
|
|
For grayscale images, this is easy. A program can use an array to hold counts for each of the possible pixel values. It can then examine each pixel in the image and increment the count for that pixel's color value. Because the image is grayscale, each pixel's red, green, and blue color components are the same. If a pixel's color component values are stored in the variable clr, the program would increment the value counts(clr). When it has examined all the pixels, the program can display their values in a histogram. |
|
|
|
|
|